<template>
  <view class="box">
    <view class="yh_input">
      <view>
        <text v-if="required" style="color: red">*</text>
        <text>{{ label }}</text>
        <text v-if="requiredRight" style="color: red">*</text>
      </view>
      <view class="inputBox">
        <nut-radiogroup
          class="radioBox"
          v-model="modelValue"
          @change="radioValueChange"
        >
          <nut-radio class="radioCell" :label="1">男</nut-radio>
          <nut-radio class="radioCell" :label="2">女</nut-radio>
        </nut-radiogroup>
      </view>
    </view>
  </view>
</template>
<script lang='ts'>
export default {
  name: "yh_input",
  props: {
    modelValue: {
      default: "",
    },
    label: {
      default: "",
    },
  },
  setup(_props, { emit }) {
    console.log(_props);
    const radioValueChange = (value) => {
      console.log(value);
      emit("update:modelValue", value);
    };
    return {
      radioValueChange,
    };
  },
};
</script>
<style lang="scss">
.box {
  background: #ffffff;
  .yh_input {
    padding: 13px 0;
    margin-left: 16px;
    border-bottom: 1px solid #eeeeee;
    background: #ffffff;

    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    text {
      width: 120px;
      font-size: 13px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #666666;
      line-height: 13px;
      padding: 0 2px;
    }
    .inputBox {
      flex: 1;
      padding: 0 16px 0 0;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: flex-end;
      .radioBox {
        display: flex;
        flex-direction: row;
        .radioCell {
          margin-left: 40px;
          font-size: 13px;
          font-family: PingFangSC, PingFangSC-Regular;
          font-weight: 400;
          text-align: left;
          color: #333333;
          .nut-radio__label{
            margin-left: 4px;
          }
        }
      }
    }
  }
}
</style>
